<template>
	<view>
		<view class="banner">
			<image src="../../static/img/img/banner01.jpg" />

		</view>
		<view class="list">
			<view class="user-list">
				<view class="user-item" v-for="(user, index) in list" :key="index">
					<image class="avatar" :src="user.path" mode="aspectFill"></image>
					<view class="info">
						<view class="username-level">
							<text class="username">{{ user.name }}</text>
							<view class="level-info">
								<view class="level-text">
									<text class="level-rating">{{ user.rating }}</text> / <text
										class="level-adr">{{ user.adr }}</text>
								</view>
							</view>
						</view>
						<view class="username-incon">
							<view class="fullname">
								<image class="level-icon" :src="user.rank_url" mode="aspectFit"></image>
								{{ user.rank_name }}
							</view>
							<view class="rating">Rating {{ user.rating }}/ Maps</view>
						</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		getOccupation,
	} from '@/api/getRank.js'
	export default {
		data() {
			return {
				list: []
			};
		},

		onLoad() {
			this.getList()
		},

		methods: {
			async getList() {
				try {
					const {
						data
					} = await getOccupation();
					this.list = data
				} catch (err) {

				}
			}
		}
	};
</script>

<style scoped>
	.banner {
		width: 100vw;
		height: 400rpx;
	}

	.banner image {
		width: 100%;
		height: 100%;
	}

	.list {
		height: calc(100vh - 410rpx);
		overflow: auto;
		margin-top: 10rpx;
	}

	.user-list {
		padding: 20rpx;
	}

	.user-item {
		display: flex;
		align-items: center;
		background-color: #2a2e34;
		padding: 20rpx;
		border-radius: 16rpx;
		margin-bottom: 20rpx;
	}

	.avatar {
		width: 80rpx;
		height: 80rpx;
		/* border-radius: 50%; */
		margin-right: 20rpx;
	}

	.info {
		flex-grow: 1;
	}

	.username-level {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 10rpx;
	}

	.username {
		font-size: 32rpx;
		color: #fff;
		font-weight: bold;
	}

	.level-info {
		display: flex;
		align-items: center;
	}

	.level-icon {
		width: 32rpx;
		height: 32rpx;
		margin-right: 10rpx;
	}

	.level-text {
		font-size: 28rpx;
		color: #bfbfbf;
	}

	.fullname {
		font-size: 24rpx;
		color: #bfbfbf;
		margin-bottom: 10rpx;
		margin-right: 10rpx;
	}

	.rating {
		font-size: 24rpx;
		color: #bfbfbf;
	}

	.level-rating {
		font-size: 32rpx;
	}

	.level-adr {
		font-size: 24rpx;
	}

	.username-incon {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
</style>